import axios from 'axios'

// 博客分类接口
export function getCategoryList(params) {
    return axios.get('/blog/category/list', { params })
}

export function addCategory(data) {
    return axios.post('/blog/category', data)
}

export function updateCategory(data) {
    return axios.put('/blog/category', data)
}

export function deleteCategory(id) {
    return axios.delete(`/blog/category/${id}`)
}

export function getCategoryById(id) {
    return axios.get(`/blog/category/${id}`)
}

// 博客文章接口
export function getArticleList(params) {
    return axios.get('/blog/article/list', { params })
}

export function addArticle(data) {
    return axios.post('/blog/article', data)
}

export function updateArticle(data) {
    return axios.put('/blog/article', data)
}

export function deleteArticle(id) {
    return axios.delete(`/blog/article/${id}`)
}

export function getArticleById(id) {
    return axios.get(`/blog/article/${id}`)
}

export function updateArticleStatus(id, status) {
    return axios.put(`/blog/article/${id}/status/${status}`)
}

export function likeArticle(id) {
    return axios.put(`/blog/article/${id}/like`)
}


